var clickUtils = require("../../utils/clickUtils");
var textUtils = require("../../utils/textUtils");
var ocrUtils = require("../../utils/ocrUtils");
var randomUtils = require("../../utils/randomUtils");
var adXiGua = require("../../ads/xiGua/index");
var Action = require("../../base/Action");
const { clickContent } = require("../../utils");
var aWatchAd = new Action("看广告", {
  interval: 10 * 60,
  maxRunSCount: 10,
  maxRunFCount: 10,
});
aWatchAd.exec = function () {
  var content = "看广告赚金币";
  if (clickContent(content)) {
    sleep(randomUtils.getRandom(2.5, 5, 1000));
    var maxAdCount = randomUtils.getRandom(2, 5);
    adXiGua.startWatchAd(maxAdCount);
    sleep(randomUtils.getRandom(2.5, 5, 1000));
    var content = "开心收下";
    if (clickContent(content)) {
      sleep(randomUtils.getRandom(1.5, 3, 1000));
      this.runSCount++;
    }
    return;
  }
  this.runFCount++;
};

module.exports = aWatchAd;
